package com.wanxi.list;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class CollectionStudent {
    public static void main(String[] args) {
        Collection<Student> collection=new ArrayList<>();
        collection.add(new Student("a",1));
        collection.add(new Student("b",2));
        collection.add(new Student("c",3));
//        for (Student s:collection
//             ) {
//            System.out.println(s);
//        }
        Iterator<Student> iterator = collection.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
    }
}
